package com.pug.mongorepository;

import com.pug.mongo.MessageMo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

/**
 * @author 飞哥
 * @Title: 学相伴出品
 * @Description: 飞哥B站地址：https://space.bilibili.com/490711252
 * 记得关注和三连哦！
 * @Description: 我们有一个学习网站：https://www.kuangstudy.com
 * @date 2022/3/21$ 3:01$
 */
@Repository
public interface MessageRepository extends MongoRepository<MessageMo,String> {
//
//
//    Page<MessageMo>  findAllByUseridEquals (String userid,Pageable pageable);
//


    /**
     * 通过实现MongoRepository 自定义查询条件
     * @param userId
     * @param pageable
     * @return
     */
    Page<MessageMo> findAllByUseridEqualsOrderByCreateTimeDesc(String userId, Pageable pageable);
}
